package teamGiga.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import teamGiga.bean.ShowingBean;
import teamGiga.dao.MovieDao;
import action.servlet.ActionForWard;

public class InsertShowingAction extends Action{
	private String path;
	private boolean redirect;

	public InsertShowingAction() {
		super();
	}
	public InsertShowingAction(String path, boolean redirect) {
		super();
		this.path = path;
		this.redirect = redirect;
	}
	
	@Override
	public ActionForWard execute(HttpServletRequest request,
			HttpServletResponse response) {
		
		int sno=0;
		int tno=Integer.parseInt(request.getParameter("tno"));
		String tname=request.getParameter("tname");
		String taddress=request.getParameter("taddress");
		int trnum=Integer.parseInt(request.getParameter("trnum"));
		String showdate=request.getParameter("showdate");
		String showtime=request.getParameter("showtime");
		int mno=Integer.parseInt(request.getParameter("mno"));
		String mname=request.getParameter("mname");
		String scapacity="";

		try {
			ShowingBean sbean=new ShowingBean(sno,tno, tname,taddress, trnum, showdate, showtime, mno, mname, scapacity);
			System.out.println(sbean);
			MovieDao.insertShowing(sbean);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return new ActionForWard(path, redirect);
	}
}
